package com.lkd.controller;

import com.lkd.dto.RegionDto;
import com.lkd.dto.VmTypeDto;
import com.lkd.entity.Node;
import com.lkd.entity.VmType;
import com.lkd.service.INodeService;
import com.lkd.service.IVmTypeService;
import com.lkd.vo.NodeVo;
import com.lkd.vo.PageBean;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/vm-service/vmType")
public class VmTypeController {

    @Autowired
    private IVmTypeService vmTypeService;

    @GetMapping("/search")
    public PageBean<VmType> search(VmTypeDto vmTypeDto){
        return vmTypeService.findList(vmTypeDto);
    }

    @PostMapping
    public void add(@RequestBody VmType vmType){
        vmTypeService.save(vmType);
    }

    @PutMapping
    public void update(@RequestBody VmType vmType){
        vmTypeService.updateById(vmType);
    }

    @DeleteMapping("/{typeId}")
    public void delete(@PathVariable Integer typeId){
        vmTypeService.removeById(typeId);
    }








}
